export const getNowDate = function (str = 'date', sign = "-") {
    let now = new Date()
    let year = now.getFullYear()
    let month = now.getMonth() + 1
    let day = now.getDate()
    month = month.toString().padStart(2, '0')
    day = day.toString().padStart(2, '0')
    //  获取更准确的时间
    const h = now.getHours().toString().padStart(2, '0')
    const m = now.getMinutes().toString().padStart(2, '0')
    const s = now.getSeconds().toString().padStart(2, '0')
    const formatDate = year + sign + month + sign + day

    if (str === 'time') {
        return formatDate + ' ' + h + ':' + m + ':' + s
    }
    return formatDate
}
